{
 "metadata": {
  "name": "",
  "signature": "sha256:c23fe55a5cb0859c9a2553bc7229cd39c6922503474091837f0bacaf572dc8e2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import pandas as pd\n",
      "loansData = pd.read_csv('http://spark-public.s3.amazonaws.com/dataanalysis/loansData.csv')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "loansData['Interest.Rate'][0:5]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 3,
       "text": [
        "81174     8.90%\n",
        "99592    12.12%\n",
        "80059    21.98%\n",
        "15825     9.99%\n",
        "33182    11.71%\n",
        "Name: Interest.Rate, dtype: object"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "/Users/nitin/dl/mangodata.csv"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mangoData = pd.read_csv('/Users/nitin/dl/mangodata.csv')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mangoData"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
        "      <th></th>\n",
        "      <th>date</th>\n",
        "      <th>med</th>\n",
        "      <th>scheduled</th>\n",
        "      <th>actual</th>\n",
        "    </tr>\n",
        "  </thead>\n",
        "  <tbody>\n",
        "    <tr>\n",
        "      <th>0  </th>\n",
        "      <td> 4/14/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>1  </th>\n",
        "      <td> 4/15/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:10</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>2  </th>\n",
        "      <td> 4/16/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>3  </th>\n",
        "      <td> 4/17/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>4  </th>\n",
        "      <td> 4/18/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  7:54</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>5  </th>\n",
        "      <td> 4/19/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:03</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>6  </th>\n",
        "      <td> 4/20/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  7:51</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>7  </th>\n",
        "      <td> 4/21/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>8  </th>\n",
        "      <td> 4/22/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:13</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>9  </th>\n",
        "      <td> 4/23/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:14</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>10 </th>\n",
        "      <td> 4/23/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 17:14</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>11 </th>\n",
        "      <td> 4/24/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  7:51</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>12 </th>\n",
        "      <td> 4/24/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 18:03</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>13 </th>\n",
        "      <td> 4/25/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:10</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>14 </th>\n",
        "      <td> 4/25/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>15 </th>\n",
        "      <td> 4/26/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:19</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>16 </th>\n",
        "      <td> 4/26/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 17:28</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>17 </th>\n",
        "      <td> 4/27/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:05</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>18 </th>\n",
        "      <td> 4/27/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 18:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>19 </th>\n",
        "      <td> 4/28/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:17</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>20 </th>\n",
        "      <td> 4/28/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 18:03</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>21 </th>\n",
        "      <td> 4/29/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:30</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>22 </th>\n",
        "      <td> 4/29/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>23 </th>\n",
        "      <td> 4/30/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>24 </th>\n",
        "      <td> 4/30/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 17:24</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>25 </th>\n",
        "      <td>  5/1/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:29</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>26 </th>\n",
        "      <td>  5/1/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 17:46</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>27 </th>\n",
        "      <td>  5/2/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:13</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>28 </th>\n",
        "      <td>  5/2/13</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 17:00</td>\n",
        "      <td> 17:28</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>29 </th>\n",
        "      <td>  5/3/13</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:08</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>...</th>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>585</th>\n",
        "      <td> 5/22/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:58</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>586</th>\n",
        "      <td> 5/23/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>587</th>\n",
        "      <td> 5/24/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td> 10:14</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>588</th>\n",
        "      <td> 5/25/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:05</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>589</th>\n",
        "      <td> 5/26/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>590</th>\n",
        "      <td> 5/27/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>591</th>\n",
        "      <td> 5/28/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>592</th>\n",
        "      <td> 5/29/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>593</th>\n",
        "      <td> 5/30/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>594</th>\n",
        "      <td> 5/31/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>595</th>\n",
        "      <td>  6/1/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>596</th>\n",
        "      <td>  6/2/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>597</th>\n",
        "      <td>  6/3/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  7:57</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>598</th>\n",
        "      <td>  6/4/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:24</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>599</th>\n",
        "      <td>  6/5/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>600</th>\n",
        "      <td>  6/6/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>601</th>\n",
        "      <td>  6/7/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:21</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>602</th>\n",
        "      <td>  6/8/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>603</th>\n",
        "      <td>  6/9/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>604</th>\n",
        "      <td> 6/10/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:06</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>605</th>\n",
        "      <td> 6/11/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:40</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>606</th>\n",
        "      <td> 6/12/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td> 10:07</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>607</th>\n",
        "      <td> 6/13/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:59</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>608</th>\n",
        "      <td> 6/14/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>609</th>\n",
        "      <td> 6/15/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td> 10:55</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>610</th>\n",
        "      <td> 6/16/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>  9:00</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>611</th>\n",
        "      <td> 6/17/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>612</th>\n",
        "      <td> 6/18/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>613</th>\n",
        "      <td> 6/19/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>614</th>\n",
        "      <td> 6/20/14</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td>  8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
        "<p>615 rows \u00d7 4 columns</p>\n",
        "</div>"
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 5,
       "text": [
        "        date           med scheduled actual\n",
        "0    4/14/13    lisinopril      8:00   8:01\n",
        "1    4/15/13    lisinopril      8:00   8:10\n",
        "2    4/16/13    lisinopril      8:00   8:02\n",
        "3    4/17/13    lisinopril      8:00   8:01\n",
        "4    4/18/13    lisinopril      8:00   7:54\n",
        "5    4/19/13    lisinopril      8:00   8:03\n",
        "6    4/20/13    lisinopril      8:00   7:51\n",
        "7    4/21/13    lisinopril      8:00   8:01\n",
        "8    4/22/13    lisinopril      8:00   8:13\n",
        "9    4/23/13    lisinopril      8:00   8:14\n",
        "10   4/23/13  atorvastatin     17:00  17:14\n",
        "11   4/24/13    lisinopril      8:00   7:51\n",
        "12   4/24/13  atorvastatin     17:00  18:03\n",
        "13   4/25/13    lisinopril      8:00   8:10\n",
        "14   4/25/13  atorvastatin     17:00    NaN\n",
        "15   4/26/13    lisinopril      8:00   8:19\n",
        "16   4/26/13  atorvastatin     17:00  17:28\n",
        "17   4/27/13    lisinopril      8:00   8:05\n",
        "18   4/27/13  atorvastatin     17:00  18:01\n",
        "19   4/28/13    lisinopril      8:00   8:17\n",
        "20   4/28/13  atorvastatin     17:00  18:03\n",
        "21   4/29/13    lisinopril      8:00   8:30\n",
        "22   4/29/13  atorvastatin     17:00    NaN\n",
        "23   4/30/13    lisinopril      8:00    NaN\n",
        "24   4/30/13  atorvastatin     17:00  17:24\n",
        "25    5/1/13    lisinopril      8:00   8:29\n",
        "26    5/1/13  atorvastatin     17:00  17:46\n",
        "27    5/2/13    lisinopril      8:00   8:13\n",
        "28    5/2/13  atorvastatin     17:00  17:28\n",
        "29    5/3/13    lisinopril      8:00   8:08\n",
        "..       ...           ...       ...    ...\n",
        "585  5/22/14  atorvastatin      8:00   9:58\n",
        "586  5/23/14  atorvastatin      8:00    NaN\n",
        "587  5/24/14  atorvastatin      8:00  10:14\n",
        "588  5/25/14  atorvastatin      8:00   8:05\n",
        "589  5/26/14  atorvastatin      8:00    NaN\n",
        "590  5/27/14  atorvastatin      8:00    NaN\n",
        "591  5/28/14  atorvastatin      8:00    NaN\n",
        "592  5/29/14  atorvastatin      8:00    NaN\n",
        "593  5/30/14  atorvastatin      8:00    NaN\n",
        "594  5/31/14  atorvastatin      8:00    NaN\n",
        "595   6/1/14  atorvastatin      8:00    NaN\n",
        "596   6/2/14  atorvastatin      8:00    NaN\n",
        "597   6/3/14  atorvastatin      8:00   7:57\n",
        "598   6/4/14  atorvastatin      8:00   9:24\n",
        "599   6/5/14  atorvastatin      8:00    NaN\n",
        "600   6/6/14  atorvastatin      8:00    NaN\n",
        "601   6/7/14  atorvastatin      8:00   9:21\n",
        "602   6/8/14  atorvastatin      8:00    NaN\n",
        "603   6/9/14  atorvastatin      8:00    NaN\n",
        "604  6/10/14  atorvastatin      8:00   9:06\n",
        "605  6/11/14  atorvastatin      8:00   8:40\n",
        "606  6/12/14  atorvastatin      8:00  10:07\n",
        "607  6/13/14  atorvastatin      8:00   9:59\n",
        "608  6/14/14  atorvastatin      8:00   8:02\n",
        "609  6/15/14  atorvastatin      8:00  10:55\n",
        "610  6/16/14  atorvastatin      8:00   9:00\n",
        "611  6/17/14  atorvastatin      8:00    NaN\n",
        "612  6/18/14  atorvastatin      8:00    NaN\n",
        "613  6/19/14  atorvastatin      8:00    NaN\n",
        "614  6/20/14  atorvastatin      8:00    NaN\n",
        "\n",
        "[615 rows x 4 columns]"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mangoData2 = pd.read_csv('/Users/nitin/dl/mangodata2.csv')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mangoData2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
        "      <th></th>\n",
        "      <th>date</th>\n",
        "      <th>dow</th>\n",
        "      <th>med</th>\n",
        "      <th>scheduled</th>\n",
        "      <th>actual</th>\n",
        "    </tr>\n",
        "  </thead>\n",
        "  <tbody>\n",
        "    <tr>\n",
        "      <th>0  </th>\n",
        "      <td> 4/14/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>1  </th>\n",
        "      <td> 4/15/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:10</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>2  </th>\n",
        "      <td> 4/16/2013</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>3  </th>\n",
        "      <td> 4/17/2013</td>\n",
        "      <td> wednesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>4  </th>\n",
        "      <td> 4/18/2013</td>\n",
        "      <td>  thursday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  7:54</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>5  </th>\n",
        "      <td> 4/19/2013</td>\n",
        "      <td>    friday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:03</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>6  </th>\n",
        "      <td> 4/20/2013</td>\n",
        "      <td>  saturday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  7:51</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>7  </th>\n",
        "      <td> 4/21/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>8  </th>\n",
        "      <td> 4/22/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:13</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>9  </th>\n",
        "      <td> 4/23/2013</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:14</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>10 </th>\n",
        "      <td> 4/24/2013</td>\n",
        "      <td> wednesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  7:51</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>11 </th>\n",
        "      <td> 4/25/2013</td>\n",
        "      <td>  thursday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:10</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>12 </th>\n",
        "      <td> 4/26/2013</td>\n",
        "      <td>    friday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:19</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>13 </th>\n",
        "      <td> 4/27/2013</td>\n",
        "      <td>  saturday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:05</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>14 </th>\n",
        "      <td> 4/28/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:17</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>15 </th>\n",
        "      <td> 4/29/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:30</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>16 </th>\n",
        "      <td> 4/30/2013</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>17 </th>\n",
        "      <td>  5/1/2013</td>\n",
        "      <td> wednesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:29</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>18 </th>\n",
        "      <td>  5/2/2013</td>\n",
        "      <td>  thursday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:13</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>19 </th>\n",
        "      <td>  5/3/2013</td>\n",
        "      <td>    friday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:08</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>20 </th>\n",
        "      <td>  5/4/2013</td>\n",
        "      <td>  saturday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:22</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>21 </th>\n",
        "      <td>  5/5/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:17</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>22 </th>\n",
        "      <td>  5/6/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:12</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>23 </th>\n",
        "      <td>  5/7/2013</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:15</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>24 </th>\n",
        "      <td>  5/8/2013</td>\n",
        "      <td> wednesday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:13</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>25 </th>\n",
        "      <td>  5/9/2013</td>\n",
        "      <td>  thursday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>26 </th>\n",
        "      <td> 5/10/2013</td>\n",
        "      <td>    friday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>27 </th>\n",
        "      <td> 5/11/2013</td>\n",
        "      <td>  saturday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:11</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>28 </th>\n",
        "      <td> 5/12/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:28</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>29 </th>\n",
        "      <td> 5/13/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td>   lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>...</th>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "      <td>...</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>585</th>\n",
        "      <td> 5/22/2014</td>\n",
        "      <td>    friday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:58</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>586</th>\n",
        "      <td> 5/23/2014</td>\n",
        "      <td>  saturday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>587</th>\n",
        "      <td> 5/24/2014</td>\n",
        "      <td>    sunday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 10:14</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>588</th>\n",
        "      <td> 5/25/2014</td>\n",
        "      <td>    monday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:05</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>589</th>\n",
        "      <td> 5/26/2014</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>590</th>\n",
        "      <td> 5/27/2014</td>\n",
        "      <td> wednesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>591</th>\n",
        "      <td> 5/28/2014</td>\n",
        "      <td>  thursday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>592</th>\n",
        "      <td> 5/29/2014</td>\n",
        "      <td>    friday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>593</th>\n",
        "      <td> 5/30/2014</td>\n",
        "      <td>  saturday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>594</th>\n",
        "      <td> 5/31/2014</td>\n",
        "      <td>    sunday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>595</th>\n",
        "      <td>  6/1/2014</td>\n",
        "      <td>    monday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>596</th>\n",
        "      <td>  6/2/2014</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>597</th>\n",
        "      <td>  6/3/2014</td>\n",
        "      <td> wednesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  7:57</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>598</th>\n",
        "      <td>  6/4/2014</td>\n",
        "      <td>  thursday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:24</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>599</th>\n",
        "      <td>  6/5/2014</td>\n",
        "      <td>    friday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>600</th>\n",
        "      <td>  6/6/2014</td>\n",
        "      <td>  saturday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>601</th>\n",
        "      <td>  6/7/2014</td>\n",
        "      <td>    sunday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:21</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>602</th>\n",
        "      <td>  6/8/2014</td>\n",
        "      <td>    monday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>603</th>\n",
        "      <td>  6/9/2014</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>604</th>\n",
        "      <td> 6/10/2014</td>\n",
        "      <td> wednesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:06</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>605</th>\n",
        "      <td> 6/11/2014</td>\n",
        "      <td>  thursday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:40</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>606</th>\n",
        "      <td> 6/12/2014</td>\n",
        "      <td>    friday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 10:07</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>607</th>\n",
        "      <td> 6/13/2014</td>\n",
        "      <td>  saturday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:59</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>608</th>\n",
        "      <td> 6/14/2014</td>\n",
        "      <td>    sunday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>609</th>\n",
        "      <td> 6/15/2014</td>\n",
        "      <td>    monday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 10:55</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>610</th>\n",
        "      <td> 6/16/2014</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>  9:00</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>611</th>\n",
        "      <td> 6/17/2014</td>\n",
        "      <td> wednesday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>612</th>\n",
        "      <td> 6/18/2014</td>\n",
        "      <td>  thursday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>613</th>\n",
        "      <td> 6/19/2014</td>\n",
        "      <td>    friday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>614</th>\n",
        "      <td> 6/20/2014</td>\n",
        "      <td>  saturday</td>\n",
        "      <td> atorvastatin</td>\n",
        "      <td> 8:00</td>\n",
        "      <td>   NaN</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
        "<p>615 rows \u00d7 5 columns</p>\n",
        "</div>"
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 7,
       "text": [
        "          date        dow           med scheduled actual\n",
        "0    4/14/2013     sunday    lisinopril      8:00   8:01\n",
        "1    4/15/2013     monday    lisinopril      8:00   8:10\n",
        "2    4/16/2013    tuesday    lisinopril      8:00   8:02\n",
        "3    4/17/2013  wednesday    lisinopril      8:00   8:01\n",
        "4    4/18/2013   thursday    lisinopril      8:00   7:54\n",
        "5    4/19/2013     friday    lisinopril      8:00   8:03\n",
        "6    4/20/2013   saturday    lisinopril      8:00   7:51\n",
        "7    4/21/2013     sunday    lisinopril      8:00   8:01\n",
        "8    4/22/2013     monday    lisinopril      8:00   8:13\n",
        "9    4/23/2013    tuesday    lisinopril      8:00   8:14\n",
        "10   4/24/2013  wednesday    lisinopril      8:00   7:51\n",
        "11   4/25/2013   thursday    lisinopril      8:00   8:10\n",
        "12   4/26/2013     friday    lisinopril      8:00   8:19\n",
        "13   4/27/2013   saturday    lisinopril      8:00   8:05\n",
        "14   4/28/2013     sunday    lisinopril      8:00   8:17\n",
        "15   4/29/2013     monday    lisinopril      8:00   8:30\n",
        "16   4/30/2013    tuesday    lisinopril      8:00    NaN\n",
        "17    5/1/2013  wednesday    lisinopril      8:00   8:29\n",
        "18    5/2/2013   thursday    lisinopril      8:00   8:13\n",
        "19    5/3/2013     friday    lisinopril      8:00   8:08\n",
        "20    5/4/2013   saturday    lisinopril      8:00   8:22\n",
        "21    5/5/2013     sunday    lisinopril      8:00   8:17\n",
        "22    5/6/2013     monday    lisinopril      8:00   8:12\n",
        "23    5/7/2013    tuesday    lisinopril      8:00   8:15\n",
        "24    5/8/2013  wednesday    lisinopril      8:00   8:13\n",
        "25    5/9/2013   thursday    lisinopril      8:00   8:02\n",
        "26   5/10/2013     friday    lisinopril      8:00   8:02\n",
        "27   5/11/2013   saturday    lisinopril      8:00   8:11\n",
        "28   5/12/2013     sunday    lisinopril      8:00   8:28\n",
        "29   5/13/2013     monday    lisinopril      8:00    NaN\n",
        "..         ...        ...           ...       ...    ...\n",
        "585  5/22/2014     friday  atorvastatin      8:00   9:58\n",
        "586  5/23/2014   saturday  atorvastatin      8:00    NaN\n",
        "587  5/24/2014     sunday  atorvastatin      8:00  10:14\n",
        "588  5/25/2014     monday  atorvastatin      8:00   8:05\n",
        "589  5/26/2014    tuesday  atorvastatin      8:00    NaN\n",
        "590  5/27/2014  wednesday  atorvastatin      8:00    NaN\n",
        "591  5/28/2014   thursday  atorvastatin      8:00    NaN\n",
        "592  5/29/2014     friday  atorvastatin      8:00    NaN\n",
        "593  5/30/2014   saturday  atorvastatin      8:00    NaN\n",
        "594  5/31/2014     sunday  atorvastatin      8:00    NaN\n",
        "595   6/1/2014     monday  atorvastatin      8:00    NaN\n",
        "596   6/2/2014    tuesday  atorvastatin      8:00    NaN\n",
        "597   6/3/2014  wednesday  atorvastatin      8:00   7:57\n",
        "598   6/4/2014   thursday  atorvastatin      8:00   9:24\n",
        "599   6/5/2014     friday  atorvastatin      8:00    NaN\n",
        "600   6/6/2014   saturday  atorvastatin      8:00    NaN\n",
        "601   6/7/2014     sunday  atorvastatin      8:00   9:21\n",
        "602   6/8/2014     monday  atorvastatin      8:00    NaN\n",
        "603   6/9/2014    tuesday  atorvastatin      8:00    NaN\n",
        "604  6/10/2014  wednesday  atorvastatin      8:00   9:06\n",
        "605  6/11/2014   thursday  atorvastatin      8:00   8:40\n",
        "606  6/12/2014     friday  atorvastatin      8:00  10:07\n",
        "607  6/13/2014   saturday  atorvastatin      8:00   9:59\n",
        "608  6/14/2014     sunday  atorvastatin      8:00   8:02\n",
        "609  6/15/2014     monday  atorvastatin      8:00  10:55\n",
        "610  6/16/2014    tuesday  atorvastatin      8:00   9:00\n",
        "611  6/17/2014  wednesday  atorvastatin      8:00    NaN\n",
        "612  6/18/2014   thursday  atorvastatin      8:00    NaN\n",
        "613  6/19/2014     friday  atorvastatin      8:00    NaN\n",
        "614  6/20/2014   saturday  atorvastatin      8:00    NaN\n",
        "\n",
        "[615 rows x 5 columns]"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# plot missed by dow \n",
      "# plot delay by dow\n",
      "# plot delay by num of days into program\n",
      "# plot on time %\n",
      "\n",
      "lisin = mangoData2['med'== 'lisinopril']"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "ename": "KeyError",
       "evalue": "False",
       "output_type": "pyerr",
       "traceback": [
        "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
        "\u001b[0;32m<ipython-input-8-f6d2a6f92a52>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;31m# plot on time %\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mlisin\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmangoData2\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'med'\u001b[0m\u001b[0;34m==\u001b[0m \u001b[0;34m'lisinopril'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   1676\u001b[0m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1677\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1678\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem_column\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1679\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1680\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m_getitem_column\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc\u001b[0m in \u001b[0;36m_getitem_column\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   1683\u001b[0m         \u001b[0;31m# get column\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1684\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1685\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_item_cache\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1686\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1687\u001b[0m         \u001b[0;31m# duplicate columns & possible reduce dimensionaility\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc\u001b[0m in \u001b[0;36m_get_item_cache\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m   1050\u001b[0m         \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1051\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1052\u001b[0;31m             \u001b[0mvalues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1053\u001b[0m             \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_box_item_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1054\u001b[0m             \u001b[0mcache\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/core/internals.pyc\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, item, fastpath)\u001b[0m\n\u001b[1;32m   2563\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2564\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misnull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2565\u001b[0;31m                 \u001b[0mloc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2566\u001b[0m             \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2567\u001b[0m                 \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0misnull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/core/index.pyc\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   1179\u001b[0m         \u001b[0mloc\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0munique\u001b[0m \u001b[0mindex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpossibly\u001b[0m \u001b[0mslice\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mmask\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1180\u001b[0m         \"\"\"\n\u001b[0;32m-> 1181\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_values_from_object\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1182\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1183\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mget_value\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseries\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/index.so\u001b[0m in \u001b[0;36mpandas.index.IndexEngine.get_loc (pandas/index.c:3656)\u001b[0;34m()\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/index.so\u001b[0m in \u001b[0;36mpandas.index.IndexEngine.get_loc (pandas/index.c:3534)\u001b[0;34m()\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/hashtable.so\u001b[0m in \u001b[0;36mpandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11911)\u001b[0;34m()\u001b[0m\n",
        "\u001b[0;32m//anaconda/lib/python2.7/site-packages/pandas/hashtable.so\u001b[0m in \u001b[0;36mpandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11864)\u001b[0;34m()\u001b[0m\n",
        "\u001b[0;31mKeyError\u001b[0m: False"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lisin = mangoData2[0:5]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 9
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lisin\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
        "      <th></th>\n",
        "      <th>date</th>\n",
        "      <th>dow</th>\n",
        "      <th>med</th>\n",
        "      <th>scheduled</th>\n",
        "      <th>actual</th>\n",
        "    </tr>\n",
        "  </thead>\n",
        "  <tbody>\n",
        "    <tr>\n",
        "      <th>0</th>\n",
        "      <td> 4/14/2013</td>\n",
        "      <td>    sunday</td>\n",
        "      <td> lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>1</th>\n",
        "      <td> 4/15/2013</td>\n",
        "      <td>    monday</td>\n",
        "      <td> lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 8:10</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>2</th>\n",
        "      <td> 4/16/2013</td>\n",
        "      <td>   tuesday</td>\n",
        "      <td> lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 8:02</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>3</th>\n",
        "      <td> 4/17/2013</td>\n",
        "      <td> wednesday</td>\n",
        "      <td> lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 8:01</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>4</th>\n",
        "      <td> 4/18/2013</td>\n",
        "      <td>  thursday</td>\n",
        "      <td> lisinopril</td>\n",
        "      <td> 8:00</td>\n",
        "      <td> 7:54</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
        "</div>"
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 10,
       "text": [
        "        date        dow         med scheduled actual\n",
        "0  4/14/2013     sunday  lisinopril      8:00   8:01\n",
        "1  4/15/2013     monday  lisinopril      8:00   8:10\n",
        "2  4/16/2013    tuesday  lisinopril      8:00   8:02\n",
        "3  4/17/2013  wednesday  lisinopril      8:00   8:01\n",
        "4  4/18/2013   thursday  lisinopril      8:00   7:54"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lisin = mangoData2[mangoData2['med'] == 'lisinopril']"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ator =  mangoData2[mangoData2['med'] == 'atorvastatin']"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 13
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import datetime as dt\n",
      "import dt.time as tm\n",
      "def mk_hr_min(stime):\n",
      "    (hr,min) = [ int(x) for x in stime.split(':') ]\n",
      "    \n",
      "def tdiff(s1, s2):\n",
      "    h1,m1 = mk_hr_min(s1)\n",
      "    h2,m2 = mk_hr_min(s2)\n",
      "    t1 = tm(h1,m1,0)\n",
      "    t2 = tm(h2,m2,0)\n",
      "    td = t2 - t1\n",
      "    return 60*td.hours + td.minutes\n",
      "    \n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}